const { defineConfig } = require('@vue/cli-service')
const path = require('path');
const resolve = (dir) => path.join(__dirname, dir);
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')

module.exports = defineConfig({
    publicPath: process.env.NODE_ENV == 'production' ? './' : '/',
    transpileDependencies: true,
    lintOnSave: false,
    devServer: {
      proxy: {
        '/api': {
            target: 'http://192.168.202.52:8081/',
            changeOrigin: true,
            pathRewrite: {
              '^/api': ''
            }
        }
      }
    },
    configureWebpack: {
      resolve: {
        fallback: {
          fs: false,
        },
      },
      plugins: [new NodePolyfillPlugin()],
    },
    chainWebpack: config => {
      config.resolve.alias.set('@', resolve('src'));
    }
})
